home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_11 / phillip2 / mainr.c < prev    next >
C/C++ Source or Header  |  1993-06-25  |  3KB  |  120 lines

  1.  
  2.    /***********************************************
  3.    *
  4.    *   file d:\cips\mainr.c
  5.    *
  6.    *   Functions: This file contains
  7.    *      main
  8.    *
  9.    *   Purpose:
  10.    *      This file contains the main calling
  11.    *      routine for a program which rotates an
  12.    *      entire 300x300 image by 90
  13.    *      degrees.
  14.    *
  15.    *   External Calls:
  16.    *      gin.c - get_image_name
  17.    *      numcvrt.c - get_integer
  18.    *                  int_convert
  19.    *      tiff.c - read_tiff_header
  20.    *      rotate.c - rotate_flip_image_array
  21.    *
  22.    *   Modifications:
  23.    *      7 April 1992 - created
  24.    *
  25.    *************************************************/
  26.  
  27. #include "cips.h"
  28.  
  29.  
  30.  
  31. short the_image[ROWS][COLS];
  32. short out_image[ROWS][COLS];
  33.  
  34. main(argc, argv)
  35.    int argc;
  36.    char *argv[];
  37. {
  38.  
  39.    char     name[80], name2[80];
  40.    int      count, length, width;
  41.    struct   tiff_header_struct image_header;
  42.  
  43.    my_clear_text_screen();
  44.  
  45.        /********************************************
  46.        *
  47.        *   Interpret the command line parameters.
  48.        *
  49.        ********************************************/
  50.  
  51.    if(argc < 3 || argc > 3){
  52.     printf(
  53.      "\n"
  54.      "\n usage: mainr in-file out_file "
  55.      "\n");
  56.     exit(0);
  57.    }
  58.  
  59.    strcpy(name, argv[1]);
  60.    strcpy(name2, argv[2]);
  61.  
  62.    create_file_if_needed(name, name2, out_image);
  63.  
  64.        /**********************************************
  65.        *
  66.        *   Read, rotate, and write each ROWSxCOLS array
  67.        *   in the input image.  Write them to the new
  68.        *   locations in the output image.
  69.        *
  70.        ***********************************************/
  71.  
  72.    count = 1;
  73.  
  74.    printf(" %d", count++);
  75.    rotate_flip_image_array(name, name2, the_image,
  76.                       out_image, 1, 1, 101, 101,
  77.                       1, 201, 101, 301, 1);
  78.  
  79.    printf(" %d", count++);
  80.    rotate_flip_image_array(name, name2, the_image,
  81.                       out_image, 1, 101, 101, 201,
  82.                       101, 201, 201, 301, 1);
  83.  
  84.    printf(" %d", count++);
  85.    rotate_flip_image_array(name, name2, the_image,
  86.                       out_image, 1, 201, 101, 301,
  87.                       201, 201, 301, 301, 1);
  88.  
  89.    printf(" %d", count++);
  90.    rotate_flip_image_array(name, name2, the_image,
  91.                       out_image, 101, 1, 201, 101,
  92.                       1, 101, 101, 201, 1);
  93.  
  94.    printf(" %d", count++);
  95.    rotate_flip_image_array(name, name2, the_image,
  96.                       out_image, 101, 101, 201, 201,
  97.                       101, 101, 201, 201, 1);
  98.  
  99.    printf(" %d", count++);
  100.    rotate_flip_image_array(name, name2, the_image,
  101.                       out_image, 101, 201, 201, 301,
  102.                       201, 101, 301, 201, 1);
  103.  
  104.    printf(" %d", count++);
  105.    rotate_flip_image_array(name, name2, the_image,
  106.                       out_image, 201, 1, 301, 101,
  107.                       1, 1, 101, 101, 1);
  108.  
  109.    printf(" %d", count++);
  110.    rotate_flip_image_array(name, name2, the_image,
  111.                       out_image, 201, 101, 301, 201,
  112.                       101, 1, 201, 101, 1);
  113.  
  114.    printf(" %d", count++);
  115.    rotate_flip_image_array(name, name2, the_image,
  116.                       out_image, 201, 201, 301, 301,
  117.                       201, 1, 301, 101, 1);
  118.  
  119. }  /* ends main  */
  120.